/**
* Created by GoLand.
* User: link1st
* Date: 2019-07-25
* Time: 12:20
 */

package routers

import (
	"github.com/gin-gonic/gin"
	"gowebsocket/controllers/home"
	"gowebsocket/controllers/systems"
	"gowebsocket/controllers/user"
)

func Init(router *gin.Engine) {
	router.LoadHTMLGlob("views/**/*")//设置views 模板路径

	// 用户组
	userRouter := router.Group("/user")//访问路由分组
	{
		userRouter.GET("/list", user.List)//用户列表
		userRouter.GET("/online", user.Online)//用户在线
		userRouter.POST("/sendMessage", user.SendMessage)//用户发送消息
		userRouter.POST("/sendMessageAll", user.SendMessageAll)//用户广播消息
	}

	// 系统
	systemRouter := router.Group("/system")
	{
		systemRouter.GET("/state", systems.Status)//获取系统状态
	}

	// home
	homeRouter := router.Group("/home")
	{
		homeRouter.GET("/index", home.Index)//首页
	}

	// router.POST("/user/online", user.Online)
}
